package com.zhengxing.jienci.user.mapper.rbac;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zhengxing.jienci.user.domain.rbac.Resource;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * ResourceMapper
 *
 * @author philbert
 * @version 1.00
 */
@Repository
public interface ResourceMapper extends BaseMapper<Resource> {

    Integer codeExist(@Param("code") String code, @Param("excludId") String excludId);

    /**
     * 根据用户名称和父ID查询资源
     *
     * @param userId   用户ID
     * @param parentId 父ID
     * @return 该用户此父ID下的资源
     */
    List<Resource> findByUserIdAndParentId(@Param("userId") String userId, @Param("parentId") String parentId);

}
